package com.zhuiYun.project.api.commoditycomment.controller;

import com.zhuiYun.project.api.commoditycomment.entity.CommodityComment;
import com.zhuiYun.project.api.commoditycomment.service.CommodityCommentService;
import com.zhuiYun.project.api.commoditycomment.model.CommodityCommentModel;
import com.zhuiYun.project.common.controller.BaseController;
import com.zhuiYun.project.common.errorCode.CommonException;
import com.zhuiYun.project.common.response.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName CommodityCommentController
 * @Description TODO 商品评论controller层
 * @Author 赵笛
 * @Date 2023/4/13 14:17
 **/
@RestController
@RequestMapping("/commodity/comment")
@Api(tags = "商品详情管理")
@Slf4j
@CrossOrigin
public class CommodityCommentController  extends BaseController{
    @Autowired
    CommodityCommentService commodityCommentService;

    /**
    * @Author 赵笛
    * @Description TODO 用户新增评论
    * @Date 2023/4/19 20:56
    * @Return com.zhuiYun.project.common.response.CommonResult
    * @param commodityComment
    */
    @PostMapping("/addComment")
    @ApiOperation(value = "用户新增评论")
    public CommonResult addComment(@RequestBody CommodityComment commodityComment)throws CommonException {
        log.info("用户新增评论");
        return commodityCommentService.addComment(commodityComment);
    }

}
